//
//  YKTextView.m
//  youkan
//
//  Created by 吴高烽 on 16/3/31.
//  Copyright © 2016年 Honsintech. All rights reserved.
//

#import "YKTextView.h"
@interface YKTextView()
@property (nonatomic ,weak)UILabel *placeHolderLable;
@end
@implementation YKTextView
-(instancetype)initWithFrame:(CGRect)frame{
    if (self =[super initWithFrame:frame]) {
        UILabel *placeHolderLaber=[[UILabel alloc]init];
        [self addSubview:placeHolderLaber];
        self.font = [UIFont systemFontOfSize:13];
        _placeHolderLable = placeHolderLaber;
    }
    return self;
}
-(void)setPlaceHolder:(NSString *)placeHolder{
    _placeHolder = placeHolder;
    self.placeHolderLable.text = placeHolder;
    self.placeHolderLable.font = [UIFont systemFontOfSize:13];
    [self.placeHolderLable sizeToFit];
}
-(void)setFont:(UIFont *)font{
    [super setFont:font];
    self.placeHolderLable.font =font;
    [self.placeHolderLable sizeToFit];

}
-(void)layoutSubviews{
    [super layoutSubviews];
    self.placeHolderLable.x=5;
    self.placeHolderLable.y=8;
}
// 默认为空
-(void)willMoveToSuperview:(UIView *)newSuperview{
    [super willMoveToSuperview:newSuperview];
    NSLog(@"%@",self.font);
}
-(void)didMoveToSuperview{
    [super didMoveToSuperview];
    NSLog(@"%@",self.font);
}

-(void)setHiddenPlaceHolder:(BOOL)HiddenPlaceHolder{
    _HiddenPlaceHolder = HiddenPlaceHolder;
    self.placeHolderLable.hidden = HiddenPlaceHolder;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
